using UnityEngine;
// ReSharper disable StringLiteralTypo

namespace BF
{

    public static class ColorExtension
    {
        public static Color NewR(this Color self, float r)
        {
            return new Color(r, self.g, self.b, self.a);
        }

        public static Color NewG(this Color self, float g)
        {
            return new Color(self.r, g, self.b, self.a);
        }

        public static Color NewB(this Color self, float b)
        {
            return new Color(self.r, self.g, b, self.a);
        }

        public static Color NewA(this Color self, float a)
        {
            return new Color(self.r, self.g, self.b, a);
        }

        public static Color Fade(this Color self, float a, float t)
        {
            return self.NewA(Mathf.Lerp(self.a, a, t));
        }

        public static Color Lerp(this Color from, Color to, float t)
        {
            return new Color(
                Mathf.Lerp(from.r, to.r, t),
                Mathf.Lerp(from.g, to.g, t),
                Mathf.Lerp(from.b, to.b, t),
                Mathf.Lerp(from.a, to.a, t));
        }
    }
}
